package com.emotion.sshticket.dao;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

import com.emotion.sshticket.vo.AdminUserVO;
import com.emotion.sshticket.vo.TicketVO;

@Repository("adminDAO")
public class AdminDAO {
	private String sqlName = "adminSQL";

	@Resource(name="sqlSession")
	private SqlSession sqlSession;

	public AdminUserVO getAdminLoginInfo(Map<String, Object> paramMap) throws Exception {
		return sqlSession.selectOne(sqlName + ".getAdminLoginInfo", paramMap);
	}

	public int getTotalTicketList(Map<String, Object> paramMap) throws Exception {
		return (Integer) sqlSession.selectOne(sqlName + ".getTotalTicketList", paramMap);
	}

	public List<TicketVO> getTicketList(Map<String, Object> paramMap) throws Exception {
		return sqlSession.selectList(sqlName + ".getTicketList", paramMap);
	}

	public TicketVO getTicketInfo(String seq) throws Exception {
		return (TicketVO) sqlSession.selectOne(sqlName + ".getTicketInfo", seq);
	}

	public void updateTicketInfo(TicketVO ticketVO) {
		sqlSession.update(sqlName+".updateTicketInfo", ticketVO);
	}

	public void updatePayState(String flag) {
		sqlSession.update(sqlName+".updatePayState", flag);
	}

	public void updateMailState(String seq) {
		sqlSession.update(sqlName+".updateMailState", seq);
	}


}